import time
import unittest
import sqlparse.exceptions
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver import Keys
from data import db
from ddt import ddt,file_data
@ddt
class A3mall(unittest.TestCase):

    def setUp(self) -> None:
        self.driver=webdriver.Firefox()
        self.driver.get('https://www.jiuxian.com/')
        self.driver.maximize_window()
        time.sleep(4)

    def tearDown(self) -> None:
        time.sleep(3)
        self.driver.quit()

    @file_data(r'D:\gao1\PythonProject4\yamla.yaml')
    def test_a3mall_01(self,sousuo):
        #点击登录
        self.driver.find_element(By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]').click()
        self.driver.implicitly_wait(10)
        #输入账号和密码
        self.driver.find_element(By.ID,'userName').send_keys('13381144084')
        self.driver.find_element(By.ID,'password').send_keys('grq200566++')
        time.sleep(15)
        self.driver.find_element(By.ID,'save').click()
        time.sleep(5)
        self.driver.find_element(By.ID,'wd').send_keys(sousuo)
        self.driver.find_element(By.XPATH,'/html/body/div[4]/div/div[2]/div[1]/form/input[2]').click()
        time.sleep(5)